package com.suixinsanren.design.proxy.demo.demo01;

import org.junit.Test;

public class DuckProxyTestDrive {

    @Test
    public void testDuckProxy() {
        Duck duck = new Duck();
        DuckProxy duckProxy = new DuckProxy(duck);
        testDuck(duckProxy);
        testDuck(duckProxy);
        testDuck(duckProxy);
        System.out.println(duckProxy.getQuackCounter());
    }

    public void testDuck(Bird bird) {
        bird.quack();
        bird.fly();
    }
}
